package com.wp.pojo.basePojo;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Data
@Accessors(chain = true)
public class SysResult implements Serializable {
    //status
    private Integer status;
    //msg
    private String msg;
    //data
    private Object data;


    /**
     *业务调用的结果方法
     */
    //失败---201
    public static SysResult fail(){
        return new SysResult(201,"业务调用失败",null);
    }
    public static SysResult fail(String msg){
        return new SysResult(201,msg,null);
    }
    //成功无返回对象---200
    public static SysResult success(){
        return new SysResult(200,"业务调用成功",null);
    }
    //成功有返回对象---200
    public static SysResult success(Object data){
        return new SysResult(200,"业务调用成功",data);
    }

    public SysResult() {
    }

    public SysResult(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

}
